package com.jg.test.Hero;

import com.jg.test.AnyTest;
import com.jg.test.Dice;
import com.jg.test.Page.Battle002;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.Comparator;

@Getter
@Setter
public class Master extends Hero {
    private String name;

    private int hp;

    private int hpLimit;

    private boolean isLevelUp;

    private boolean isDead;

    private String skill0 = "冰冻射线";

    private String skill1 = "闪电链";

    private String skill2 = "火球术";

    private String skill3 = "即死";

    public int skill0need = 3;

    public int skill1need = 4;

    public int skill2need = 5;

    public int skill3need = 6;

    private int skillNum = 4;


    public Master() {
        name = "巫师";
        hp = 1;
        hpLimit = 1;
        isLevelUp = false;
        isDead = false;
    }

    // 伤害类型，[x,y]:x伤害量，y伤害类型，0，可分担，1，不可分担，2群体伤害

    public boolean skill0Check() {
        ArrayList<Dice> dice = new ArrayList<>();
        for (Dice d : Battle002.dice
        ) {
            if (d.isUsed()) {
                dice.add(d);
            }
        }
        dice.sort(Comparator.comparingInt(Dice::getPoint));
        return dice.get(0).getPoint() == dice.get(dice.size() - 1).getPoint();
    }

    public int[] skill0() {
        int i = AnyTest.monsters.get(0).get(0).getRollNum();
        AnyTest.monsters.get(0).get(0).setRollNum(i - 2);
        return new int[]{0, 0};
    }

    public boolean skill1Check() {
        return skill0Check();
    }

    public int[] skill1() {
        return new int[]{1,2};
    }

    public boolean skill2Check() {
        return skill0Check();
    }

    public int[] skill2() {
        return new int[]{6,0};
    }

    public boolean skill3Check() {
        return skill0Check();
    }

    public int[] skill3() {
        return new int[]{66,2};
    }
}
